﻿@page "/history"
@inherits DiariesPageComponentBase

<link href="css/extend/masa-blazor-extend-enqueued-snackbars.css" rel="stylesheet" />

<MAppBar App="true"
         Elevation="0">
    @if (NormalCalendarVisible)
    {
        <MToolbarTitle Class="font-weight-bold">
            @(I18n.T("History.Calendar"))
        </MToolbarTitle>
    }
    else
    {
        <div class="float-calendar">
            <MTextField @bind-Value="PickedDate"
                        Class="rounded-lg text-h6 font-weight-bold"
                        Style="cursor:pointer;"
                        Dense="true"
                        Readonly="true"
                        Solo="true"
                        Flat="true"
                        HideDetails="@("auto")"
                        OnMouseUp="()=>ShowFloatCalendar=true"
                        PrependIcon="mdi-calendar">
            </MTextField>
        </div>
    }
</MAppBar>

<ScrollContainer @ref="scrollContainer">
    <div class="normal-calendar">
        <MDatePicker @bind-Value="PickedDate"
                     Class="rounded-lg my-picker mb-5 pt-4"
                     TValue="DateOnly"
                     ShowCurrent="false"
                     FullWidth="true"
                     NoTitle="true"
                     Color="primary"
                     Events="EventsDates"
                     EventColor='"primary"'
                     Locale="@(I18n.Culture.Name)">
        </MDatePicker>
    </div>

    <DiaryCardList @bind-Tags="Tags"
                   Value="Diaries"
                   OnUpdate="UpdateEventsDates">
    </DiaryCardList>
</ScrollContainer>

<MyDatePicker @bind-Value="ShowFloatCalendar"
@bind-Date="PickedDate"
              Events="EventsDates"
              EventColor='"primary"'>
</MyDatePicker>